
package com.trp.model;


public abstract class CIMModel {

    public enum Type {
        SUBSTATION, POLE, CIRCUIT, CIRCUIT_SECTION, OVERHEAD_CIRCUIT, POLE_SITE, CABLE
    }

    protected String mID;

    protected String mName;

    protected Type mType;

    public CIMModel() {
        init();
    }

    public CIMModel(String mID, String mName) {
        super();
        this.mID = mID;
        this.mName = mName;
        init();
    }

    protected abstract void init();

    public String getID() {
        return mID;
    }

    public void setID(String mID) {
        this.mID = mID;
    }

    public String getName() {
        return mName;
    }

    public void setName(String mName) {
        this.mName = mName;
    }

    public Type getType() {
        return this.mType;
    }

    @Override
    public int hashCode() {
        return this.mID == null || this.mID.isEmpty() ? 0 : Integer.parseInt(this.mID);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        CIMModel other = (CIMModel)obj;
        if (this.mID == null) {
            return false;
        } else if (!this.mID.equals(other.mID)) {
            return false;
        }
        return true;
    }

}
